/*
 * @Author: error: git config user.name && git config user.email & please set dead value or install git
 * @Date: 2022-08-16 10:26:50
 * @LastEditors: error: git config user.name && git config user.email & please set dead value or install git
 * @LastEditTime: 2022-08-23 15:07:54
 * @FilePath: \施航4阶段react\src\components\Addacustomer.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Button, Form, Input } from 'antd';
import React from 'react';
import { useNavigate } from 'react-router-dom'
import InputComponents from '../pages/InputComponents.jsx'
import axios from 'axios';

const Addacustomer = () => {
    const onFinish = (values) => {
        axios({
            method: "post",
            url: "http://localhost:3000/",
            headers: {

            }, data: {

            }
        }).then((res) => {
            console.log(res);
            clickCityHandle();
        });
    }



    const onFinishFailed = (errorInfo) => {
        console.log('Failed:', errorInfo);
    };
    const navigate = useNavigate();
    function clickCityHandle() {
        navigate('/home/7/khxx')
    }

    let supplierValue = null;
    const supplierData = [
        { id: 111, value: '传统渠道' },
    ]

    const supplierDatas = [
        { id: 666, value: '二批价' },
    ]
    const supplierDatass = [
        { id: 1, value: '员工A' },
    ]
    const supplier = (a) => {
        supplierValue = a
        return console.log('父组件获取的值：', supplierValue)
    }

    return (
        <>
            <div className='Lists'>
                <div>添加客户</div>
                <Button type="primary" onClick={clickCityHandle}>返回</Button>
            </div>
            <div className='addsupply'>
                <div className='addsupplys'>添加供货商</div>
                <Form
                    name="basic"
                    labelCol={{
                        span: 8,
                    }}
                    wrapperCol={{
                        span: 16,
                    }}
                    initialValues={{
                        remember: true,
                    }}
                    onFinish={onFinish}
                    onFinishFailed={onFinishFailed}
                    autoComplete="off"
                >
                    <Form.Item
                        label="客户名称"
                        name="client"
                        rules={[
                            {
                                required: true,
                                message: '请输入客户名称',
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>
                    <Form.Item
                        label="客户地址"
                        name="client"
                        rules={[
                            {
                                required: true,
                                message: '请输入客户地址',
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>
                    <Form.Item
                        label="经度"
                        name="client"
                        rules={[
                            {
                                required: true,
                                message: 'Please input your username!',
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>

                    <Form.Item
                        label="纬度"
                        name="client"
                        rules={[
                            {
                                required: true,
                                message: 'Please input your username!',
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>
                    <Form.Item
                        label="客户类型"
                        name="client"
                        rules={[
                            {
                                required: true,
                                message: 'Please input your username!',
                            },
                        ]}
                    >
                        <InputComponents InputValue={supplierData} passData={supplier} placeholder='供货商' />
                    </Form.Item>
                    <Form.Item
                        label="价格体系"
                        name="client"
                        rules={[
                            {
                                required: true,
                                message: 'Please input your username!',
                            },
                        ]}
                    >
                        <InputComponents InputValue={supplierDatas} passData={supplier} placeholder='价格一' />
                    </Form.Item>
                    <Form.Item
                        label="营业面积"
                        name="client"
                        rules={[
                            {
                                required: true,
                                message: 'Please input your username!',
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>
                    <Form.Item
                        label="联系人"
                        name="client"
                        rules={[
                            {
                                // required: true,
                                message: 'Please input your username!',
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>
                    <Form.Item
                        label="手机号码"
                        name="client"
                        rules={[
                            {
                                // required: true,
                                message: 'Please input your username!',
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>
                    <Form.Item
                        label="固话"
                        name="client"
                        rules={[
                            {
                                // required: true,
                                message: 'Please input your username!',
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>
                    <Form.Item
                        label="负责人员"
                        name="client"
                        rules={[
                            {
                                // required: true,
                                message: 'Please input your username!',
                            },
                        ]}
                    >
                        <InputComponents InputValue={supplierDatass} passData={supplier} placeholder='当前登录人' />
                    </Form.Item>
                    <Form.Item
                        label="客户图片"
                        name="client"
                        rules={[
                            {
                                // required: true,
                                message: 'Please input your username!',
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>
                    <Form.Item
                        label="上传时间"
                        name="client"
                        rules={[
                            {
                                // required: true,
                                message: 'Please input your username!',
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>


                    <Form.Item
                        wrapperCol={{
                            offset: 8,
                            span: 16,
                        }}
                    >
                        <Button type="primary" htmlType="submit">
                            提交
                        </Button>
                    </Form.Item>
                </Form>
            </div>
        </>
    );
};

export default Addacustomer;